<?php
Util::tsRegisterAssetJs('_form.js')
?>
<div class="form">
    <?php
    /** @var MenuController $this */
    /** @var Menu $model */
    /** @var AweActiveForm $form */
    $form = $this->beginWidget('ext.AweCrud.components.AweActiveForm', array(
        'id' => 'menu-form',
        'enableAjaxValidation' => true,
    'clientOptions' => array('validateOnSubmit' => true, 'validateOnChange' => false,),
    'enableClientValidation' => false,
        'htmlOptions' => array(
            'enctype' => 'multipart/form-data',
        ),
    ));
    ?>

    <div class="container-fluid">
        <div class="row-fluid span">
            <div class="span5">

                <div class="widget blue">
                    <div class="widget-title">
                        <h4><i class="icon-group"></i> Detalles del Menu</h4>
                    </div>
                    <div class="widget-body" style="display: block;">

                        <!--<p class="note">-->
                            <!--< ?php // echo Yii::t('AweCrud.app', 'Fields with') ?> <span class="required">*</span>-->
                        <!--//<? php // echo Yii::t('AweCrud.app', 'are required') ?>.    </p>-->

                        <?php // echo $form->errorSummary($model) ?>

                        <?php echo $form->textFieldRow($model, 'nombre', array('maxlength' => 45)) ?>
                        <?php echo $form->textFieldRow($model, 'precio', array('maxlength' => 10)) ?>
                        <?php echo $form->dropDownListRow($model, 'seccion_id', array('' => ' -- Seleccione -- ') + CHtml::listData(MenuSeccion::model()->findAll(), 'id', MenuSeccion::representingColumn())) ?>
                            <?php echo $form->textAreaRow($model, 'descripcion', array('rows' => 3, 'cols' => 50)) ?>
                  <div class="row">
                            <?php echo $form->labelEx($model, 'imagen'); ?>        <?php echo CHtml::activeFileField($model, 'imagen'); ?>  
                        <?php echo $form->error($model, 'imagen'); ?></div>
                        <?php if (!empty($model->imagen) && !$model->isNewRecord) { ?><div class="row"  style="border-style: solid;  padding: 3px;border-width:4px; width: 200px; border-color: #C5BCBC; background-color: #EEEEE0">
                                <?php echo CHtml::image(Yii::app()->request->baseUrl . '/uploads/images/' . $model->imagen, "imagen", array('id' => 'target', "width" => 200)); ?>  
                            </div>
                        <?php } ?>

                                 
                                 <?php if ($model->isNewRecord || empty($model->imagen)) : ?><div class="row" style="border-style: solid;  padding: 3px;border-width:4px; width: 200px; border-color: #C5BCBC; background-color: #EEEEE0
                                 ">
                            <?php echo CHtml::image(Yii::app()->request->baseUrl . '/uploads/images/placeHolder.gif', "imagen", array('id' => 'target', "width" => 200)); ?>  
                            </div>
<?php endif; ?> 



                       
                    </div>
                </div>


            </div>

            <div class="span7">
                <div class="widget yellow ">
                    <div class="widget-title">
                        <h4><i class="icon-bolt"></i> Productos del Menu</h4>
                    </div>
                    <div class="widget-body" style="display: block;">
                        
                      <div style="max-height: 320px;overflow: auto;">
                <table id="menu" class="items table table-striped table-bordered table-hover table-advance table-condensed">
                    <thead>
                        <tr>
                            <th id="orden-producto-grid_c0">Producto</th>
                            <th style="width:80px" id="orden-producto-grid_c1">Cantidad</th>
                            <th id="orden-producto-grid_c2">Unidad</th>
                           
                            <th class="button-column" id="orden-producto-grid_c3">&nbsp;</th>
                        </tr>
                    </thead>
                    <tbody >
                        <!-- CONTENIDO DE LA TABLA -->
                    </tbody>
                </table>
            </div>
                           
                           <div class="space20"></div>
                           <div class="row-fluid">
                                               <!--<a href="#mainModal" role="button" class="btn btn-primary" data-toggle="modal" id="agregarProducto" ><i class="icon-plus icon-white"></i> Agrega Producto</a>-->
                               
                                 <button id="agregarProducto" style="
                            background:#2fade7; 
                            color: white;
                            outline: none;
                            border-radius: 0px;
                            border: none;" type="button" class="btn btn-primary ">
                        <i class=" icon-plus icon-white"></i>
                        Agregar Productos
                    </button>

                           </div>
            <div class="space20"></div>

                    </div>
                </div>

            </div>
            
        </div>
        <div class="row-fluid">
            <div class="form-actions  span12" style="text-align: center;">
                            <?php
                            $this->widget('bootstrap.widgets.TbButton', array(
                                'buttonType' => 'submit',
                                'type' => 'primary',
                                'label' => $model->isNewRecord ? Yii::t('AweCrud.app', 'Create') : Yii::t('AweCrud.app', 'Save'),
                            ));
                            ?>
                            <?php
                            $this->widget('bootstrap.widgets.TbButton', array(
                                //'buttonType'=>'submit',
                                'label' => Yii::t('AweCrud.app', 'Cancel'),
                                'htmlOptions' => array('onclick' => 'javascript:history.go(-1)')
                            ));
                            ?>
                        </div>

    </div>
    </div>

    
<?php if (!$model->isNewRecord): ?>

    <script>
        var $pedidoId = <?php echo $model->id; ?>;
        $vacio = false;
    </script>
<?php else: ?>
    <script>

        $vacio = true;
    </script>
<?php endif; ?>
    
<?php $this->endWidget(); ?>
</div>